// Appendix Table 9: F-Test for equality of coefficients
use "$dir\DataSCLB", clear
set matsize 4000


mat MatF = J(2,2,.)
local MT = 1
local CCT = 1
local j = 1
		// Estimation for each treatment arm
		foreach var in MT CCT {
		    set seed 34520730
			qui sqreg EL_EGRA_PCA_Index  MT_Program CCT_Program, q(0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95) 	
			forvalues q = 10(5)90 {
				qui test [q05]`var'_Program = [q`q']`var'_Program, accum
			}
				test [q05]`var'_Program = [q95]`var'_Program, accum
				scalar F = round(r(F),0.001)
				scalar pvalue = round(r(p),0.001)
				mat MatF[``var'',`j'] = F
				local  `var' = ``var''+1
				mat MatF[``var'',`j']=pvalue
				local j = `j'+1
				local `var' = ``var''+1
		
	}
	// Export
	clear
	set obs 2
	gen Statistic = "" 
	replace Statistic = "F-Stat" in 1
	gen par_l = ""
	gen par_r = ""
	replace par_l = "(" in 2
	replace par_r = ")" in 2
	svmat MatF 
	gen str Full_Program = par_l+strofreal(MatF1, "%12.3fc")+par_r
	gen str Reduced_Program = par_l+strofreal(MatF2,"%12.3fc")+par_r
	keep Statistic Full_Program Reduced_Program

save "$output/AppendixTable9.dta", replace